package com.ruan.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *
 * @TableName tb_discuss
 */
@TableName(value ="tb_discuss")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
public class Discuss implements Serializable {
    /**
     *
     */
    @ApiModelProperty(value = "评论id")
    @TableId(type = IdType.AUTO)
    private Integer discussId;

    /**
     *
     */
    @ApiModelProperty(value = "农业知识id")
    private Integer knowledgeId;

    /**
     *
     */
    @ApiModelProperty(value = "评论拥有者")
    private String ownName;

    /**
     *
     */
    @ApiModelProperty(value = "评论内容")
    private String content;

    /**
     *
     */
    @ApiModelProperty(value = "评论时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Discuss other = (Discuss) that;
        return (this.getDiscussId() == null ? other.getDiscussId() == null : this.getDiscussId().equals(other.getDiscussId()))
            && (this.getKnowledgeId() == null ? other.getKnowledgeId() == null : this.getKnowledgeId().equals(other.getKnowledgeId()))
            && (this.getOwnName() == null ? other.getOwnName() == null : this.getOwnName().equals(other.getOwnName()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDiscussId() == null) ? 0 : getDiscussId().hashCode());
        result = prime * result + ((getKnowledgeId() == null) ? 0 : getKnowledgeId().hashCode());
        result = prime * result + ((getOwnName() == null) ? 0 : getOwnName().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", discussId=").append(discussId);
        sb.append(", knowledgeId=").append(knowledgeId);
        sb.append(", ownName=").append(ownName);
        sb.append(", content=").append(content);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
